$(function () {
    getServiceTypeFindAll()
});
function getServiceTypeFindAll() {
    let result =myAjax('/back/serviceType/findType','get',{token:$.cookie("token")});
    data = result.list;
    let html = "";
    for (let i = 0; i < data.length; i++) {
        html += '<option value="' + data[i].id + '">' + data[i].serviceType + '</option>';
    }
    $("#roomType").html(html);//将页面格式加载到页面布局
}
function addCustomer() {
    let data = {
        username: $("#username").val(),
        sex: $("input[name='sex']:checked").val(),
        phone: $("#phone").val(),
        roomType: $("#roomType option:selected").text(),
        channel: $("input[name='channel']:checked").val(),
        reservationTime: $("#reservationTime").val(),
        checkInTime: $("#checkInTime").val(),
        checkOutTime: $("#checkOutTime").val(),
        token:$.cookie("token")
    };
    let result = myAjax('/back/order/orderAdd','post',data);
    if (result === 1) {
        alert("添加成功！");
        //页面跳转，下面两种方式都可以
        // window.location.href="";
        $("#right").load('../back/order/orderManage.html');//_blank 在新窗口中打开被链接文档。
    } else {
        alert("添加失败");
    }
}
function cancelOreder() {
    $("#right").load('/back/order/orderManage.html');
}